package work.bean;

import lombok.Data;
import work.entity.Bookware;
import work.entity.Borrow;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class ReaderHistory {
    private String bookName;
    private String bookAuthor;
    private String bookPublisher;
    private String bookType;
    private double bookGrade;
    private Date borrowDate;
    private Date realDate;
    private String borrowStatus;
    private String punishmentType;
    private double punishmentPrice;
    private String punishmentStatus;
    private String borrowId;
    private String bookId;
    private Date shouldData;

    // 获取一个读者借阅历史列表
    public List<ReaderHistory> getReaderHistory(List<Borrow> borrows, List<Bookware> bookwares) {
        List<ReaderHistory> readerHistoryArrayList = new ArrayList<>();
        for (int i = 0; i < bookwares.size(); i++) {
            ReaderHistory readerHistory = new ReaderHistory();
            readerHistory.setBookName(bookwares.get(i).getBookName());
            readerHistory.setBookAuthor(bookwares.get(i).getBookAuthor());
            readerHistory.setBookPublisher(bookwares.get(i).getBookPublisher());
            readerHistory.setBookType(bookwares.get(i).getBookType());
            readerHistory.setBookGrade(bookwares.get(i).getBookGrade());
            readerHistory.setBorrowId(borrows.get(i).getBorrowId());
            readerHistory.setBookId(borrows.get(i).getBookId());
            readerHistory.setBorrowDate(borrows.get(i).getBorrowDate());
            readerHistory.setShouldData(borrows.get(i).getShouldDate());
            readerHistory.setRealDate(borrows.get(i).getRealDate());
            readerHistory.setBorrowStatus(borrows.get(i).getBorrowStatus());
            readerHistory.setPunishmentType(borrows.get(i).getPunishmentType());
            readerHistory.setPunishmentPrice(borrows.get(i).getPunishmentPrice());
            readerHistory.setPunishmentStatus(borrows.get(i).getPunishmentStatus());
            readerHistoryArrayList.add(readerHistory);
        }
        return readerHistoryArrayList;
    }
}
